package com.aifund.app.service.impl;

import com.aifund.app.service.TutorialVideoService;
import com.aifund.common.dao.TutorialVideoDao;
import com.aifund.common.entity.TutorialVideo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author deng
 */
@Service
public class TutorialVideoServiceImpl implements TutorialVideoService {

    @Autowired
    TutorialVideoDao tutorialVideoDao;

    @Override
    public void save(TutorialVideo tutorialVideo) {
        tutorialVideoDao.save(tutorialVideo);
    }

    @Override
    public List<TutorialVideo> getTutors(int getNumber) {
        List<TutorialVideo> all = tutorialVideoDao.findAll();
        return all.size()>=getNumber?all.subList(0,getNumber):all.subList(0,all.size());
    }
}
